import { FairyEditor } from 'csharp';
import UrlUtils from './com/utils/UrlUtils';
import UISystem from './fgui/UISystem';
import UIPluginView from './fgui/view/UIPluginView';
import Global from './Global';
// import { genCode } from './GenCode_TS';

const App = FairyEditor.App;

// console.log("__dirname: " +  eval("__dirname"));
//eval("__dirname") main.js 所在的位置
const CUR_PATH:string = eval("__dirname");
const Path_Project:string = CUR_PATH.substr( 0 , CUR_PATH.indexOf("/") );
const Path_Bin:string = Path_Project + "/bin/";

UrlUtils.ROOT_BIN = FairyEditor.App.pluginManager.basePath + "/" + Path_Bin;
console.log("--------->FAIRUI: " +  UrlUtils.FAIRUI);

// App.pluginManager.LoadUIPackage(UrlUtils.FAIRUI + 'Basic');
// App.pluginManager.LoadUIPackage(UrlUtils.FAIRUI + 'common');
// App.pluginManager.LoadUIPackage(UrlUtils.FAIRUI + 'plugin');

function onEnable(){

}

function onDestroy() {
    //do cleanup here
}

App.add_onProjectOpened( ()=>{
    Global.init();
} );

//这个方法会报错有问题！
// FairyEditor.App.menu.AddItem( "插件" , "plugin" , (list)=>{});  

export { onEnable, onDestroy }; // onPublish,

